

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>federatedml.param.param &mdash; FATE 1.0 documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script type="text/javascript" src="../../../_static/jquery.js"></script>
        <script type="text/javascript" src="../../../_static/underscore.js"></script>
        <script type="text/javascript" src="../../../_static/doctools.js"></script>
        <script type="text/javascript" src="../../../_static/language_data.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    <link rel="index" title="Index" href="../../../genindex.html" />
    <link rel="search" title="Search" href="../../../search.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="../../../index.html" class="icon icon-home"> FATE
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <!-- Local TOC -->
              <div class="local-toc"></div>
            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../index.html">FATE</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../index.html">Docs</a> &raquo;</li>
        
          <li><a href="../../index.html">Module code</a> &raquo;</li>
        
      <li>federatedml.param.param</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <h1>Source code for federatedml.param.param</h1><div class="highlight"><pre>
<span></span><span class="ch">#!/usr/bin/env python    </span>
<span class="c1"># -*- coding: utf-8 -*- </span>

<span class="c1">#</span>
<span class="c1">#  Copyright 2019 The FATE Authors. All Rights Reserved.</span>
<span class="c1">#</span>
<span class="c1">#  Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span>
<span class="c1">#  you may not use this file except in compliance with the License.</span>
<span class="c1">#  You may obtain a copy of the License at</span>
<span class="c1">#</span>
<span class="c1">#      http://www.apache.org/licenses/LICENSE-2.0</span>
<span class="c1">#</span>
<span class="c1">#  Unless required by applicable law or agreed to in writing, software</span>
<span class="c1">#  distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span>
<span class="c1">#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<span class="c1">#  See the License for the specific language governing permissions and</span>
<span class="c1">#  limitations under the License.</span>
<span class="c1">#</span>
<span class="c1">################################################################################</span>
<span class="c1">#</span>
<span class="c1">#</span>
<span class="c1">################################################################################</span>
<span class="kn">from</span> <span class="nn">federatedml.util</span> <span class="k">import</span> <span class="n">consts</span>
<span class="kn">import</span> <span class="nn">copy</span>


<div class="viewcode-block" id="DataIOParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.DataIOParam">[docs]</a><span class="k">class</span> <span class="nc">DataIOParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define dataio parameters that used in federated ml.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    input_format : str, accepted &#39;dense&#39;,&#39;sparse&#39; &#39;tag&#39; only in this version. default: &#39;dense&#39;</span>

<span class="sd">    delimitor : str, the delimitor of data input, default: &#39;,&#39;</span>

<span class="sd">    data_type : str, the data type of data input, accedted &#39;float&#39;,&#39;float64&#39;,&#39;int&#39;,&#39;int64&#39;,&#39;str&#39;,&#39;long&#39;</span>
<span class="sd">               &quot;default: &quot;float64&quot;</span>

<span class="sd">    tag_with_value: bool, use if input_format is &#39;tag&#39;, if tag_with_value is True, input column data format should be tag[delimitor]value, otherwise is tag only</span>

<span class="sd">    tag_value_delimitor: str, use if input_format is &#39;tag&#39; and &#39;tag_with_value&#39; is True, delimitor of tag[delimitor]value column value.</span>

<span class="sd">    missing_fill : bool, need to fill missing value or not, accepted only True/False, default: True</span>

<span class="sd">    default_value : None or single object type or list, the value to replace missing value. </span>
<span class="sd">                    if None, it will use default value define in federatedml/feature/imputer.py,</span>
<span class="sd">                    if single object, will fill missing value with this object,</span>
<span class="sd">                    if list, it&#39;s length should be the sample of input data&#39; feature dimension,</span>
<span class="sd">                        means that if some column happens to have missing values, it will replace it</span>
<span class="sd">                        the value by element in the identical position of this list.</span>
<span class="sd">                    default: None</span>

<span class="sd">    missing_fill_method: None or str, the method to replace missing value, should be one of [None, &#39;min&#39;, &#39;max&#39;, &#39;mean&#39;, &#39;designated&#39;], default: None</span>

<span class="sd">    missing_impute: None or list, element of list can be any type, or auto generated if value is None, define which values to be consider as missing, default: None </span>

<span class="sd">    outlier_replace: bool, need to replace outlier value or not, accepted only True/False, default: True</span>

<span class="sd">    outlier_replace_method: None or str, the method to replace missing value, should be one of [None, &#39;min&#39;, &#39;max&#39;, &#39;mean&#39;, &#39;designated&#39;], default: None</span>
<span class="sd">   </span>
<span class="sd">    outlier_impute: None or list,  element of list can be any type, which values should be regard as missing value, default: None</span>

<span class="sd">    outlier_replace_value: None or single object type or list, the value to replace outlier. </span>
<span class="sd">                    if None, it will use default value define in federatedml/feature/imputer.py,</span>
<span class="sd">                    if single object, will replace outlier with this object,</span>
<span class="sd">                    if list, it&#39;s length should be the sample of input data&#39; feature dimension,</span>
<span class="sd">                        means that if some column happens to have outliers, it will replace it</span>
<span class="sd">                        the value by element in the identical position of this list.</span>
<span class="sd">                    default: None</span>

<span class="sd">    with_label : bool, True if input data consist of label, False otherwise. default: &#39;false&#39;</span>

<span class="sd">    label_idx : int, accepted &#39;int&#39;,&#39;long&#39; only, use when with_label is True. default: &#39;false&#39;</span>

<span class="sd">    label_type : object, accepted &#39;int&#39;,&#39;int64&#39;,&#39;float&#39;,&#39;float64&#39;,&#39;long&#39;,&#39;str&#39; only,</span>
<span class="sd">                use when with_label is True. default: &#39;false&#39;</span>

<span class="sd">    output_format : str, accepted &#39;dense&#39;,&#39;sparse&#39; only in this version. default: &#39;dense&#39;</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">input_format</span><span class="o">=</span><span class="s2">&quot;dense&quot;</span><span class="p">,</span> <span class="n">delimitor</span><span class="o">=</span><span class="s1">&#39;,&#39;</span><span class="p">,</span> <span class="n">data_type</span><span class="o">=</span><span class="s1">&#39;float64&#39;</span><span class="p">,</span>
                 <span class="n">tag_with_value</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">tag_value_delimitor</span><span class="o">=</span><span class="s2">&quot;:&quot;</span><span class="p">,</span>
                 <span class="n">missing_fill</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">default_value</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">missing_fill_method</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">missing_impute</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">outlier_replace</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">outlier_replace_method</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">outlier_impute</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">outlier_replace_value</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
                 <span class="n">with_label</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">label_idx</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
                 <span class="n">label_type</span><span class="o">=</span><span class="s1">&#39;int&#39;</span><span class="p">,</span> <span class="n">output_format</span><span class="o">=</span><span class="s1">&#39;dense&#39;</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">input_format</span> <span class="o">=</span> <span class="n">input_format</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">delimitor</span> <span class="o">=</span> <span class="n">delimitor</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">data_type</span> <span class="o">=</span> <span class="n">data_type</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">tag_with_value</span> <span class="o">=</span> <span class="n">tag_with_value</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">tag_value_delimitor</span> <span class="o">=</span> <span class="n">tag_value_delimitor</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">missing_fill</span> <span class="o">=</span> <span class="n">missing_fill</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">default_value</span> <span class="o">=</span> <span class="n">default_value</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">missing_fill_method</span> <span class="o">=</span> <span class="n">missing_fill_method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">missing_impute</span> <span class="o">=</span> <span class="n">missing_impute</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">outlier_replace</span> <span class="o">=</span> <span class="n">outlier_replace</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">outlier_replace_method</span> <span class="o">=</span> <span class="n">outlier_replace_method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">outlier_impute</span> <span class="o">=</span> <span class="n">outlier_impute</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">outlier_replace_value</span> <span class="o">=</span> <span class="n">outlier_replace_value</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">with_label</span> <span class="o">=</span> <span class="n">with_label</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">label_idx</span> <span class="o">=</span> <span class="n">label_idx</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">label_type</span> <span class="o">=</span> <span class="n">label_type</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">output_format</span> <span class="o">=</span> <span class="n">output_format</span></div>


<div class="viewcode-block" id="EncryptParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.EncryptParam">[docs]</a><span class="k">class</span> <span class="nc">EncryptParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define encryption method that used in federated ml.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    method : str, default: &#39;Paillier&#39;</span>
<span class="sd">        If method is &#39;Paillier&#39;, Paillier encryption will be used for federated ml.</span>
<span class="sd">        To use non-encryption version in HomoLR, just set this parameter to be any other str.</span>
<span class="sd">        For detail of Paillier encryption, please check out the paper mentioned in README file.</span>

<span class="sd">    key_length : int, default: 1024</span>
<span class="sd">        Used to specify the length of key in this encryption method. Only needed when method is &#39;Paillier&#39;</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="n">consts</span><span class="o">.</span><span class="n">PAILLIER</span><span class="p">,</span> <span class="n">key_length</span><span class="o">=</span><span class="mi">1024</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">method</span> <span class="o">=</span> <span class="n">method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">key_length</span> <span class="o">=</span> <span class="n">key_length</span></div>


<div class="viewcode-block" id="EncryptedModeCalculatorParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.EncryptedModeCalculatorParam">[docs]</a><span class="k">class</span> <span class="nc">EncryptedModeCalculatorParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define the encrypted_mode_calulator parameters.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    mode: str, support &#39;strict&#39;, &#39;fast&#39;, &#39;balance&#39; only, default: strict</span>

<span class="sd">    re_encrypted_rate: float or int, numeric number, use when mode equals to &#39;strict&#39;, defualt: 1</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s2">&quot;strict&quot;</span><span class="p">,</span> <span class="n">re_encrypted_rate</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">mode</span> <span class="o">=</span> <span class="n">mode</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">re_encrypted_rate</span> <span class="o">=</span> <span class="n">re_encrypted_rate</span></div>


<div class="viewcode-block" id="EvaluateParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.EvaluateParam">[docs]</a><span class="k">class</span> <span class="nc">EvaluateParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define the evaluation method of binary/multiple classification and regression</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    metrics: A list of evaluate index. Support &#39;auc&#39;, &#39;ks&#39;, &#39;lift&#39;, &#39;precision&#39; ,&#39;recall&#39; and &#39;accuracy&#39;, &#39;explain_variance&#39;,</span>
<span class="sd">            &#39;mean_absolute_error&#39;, &#39;mean_squared_error&#39;, &#39;mean_squared_log_error&#39;,&#39;median_absolute_error&#39;,&#39;r2_score&#39;,&#39;root_mean_squared_error&#39;.</span>
<span class="sd">            For example, metrics can be set as [&#39;auc&#39;, &#39;precision&#39;, &#39;recall&#39;], then the results of these indexes will be output.</span>

<span class="sd">    classi_type: string, support &#39;binary&#39; for HomoLR, HeteroLR and Secureboosting. support &#39;regression&#39; for Secureboosting. &#39;multi&#39; is not support these version</span>

<span class="sd">    pos_label: specify positive label type, can be int, float and str, this depend on the data&#39;s label, this parameter effective only for &#39;binary&#39;</span>

<span class="sd">    thresholds: A list of threshold. Specify the threshold use to separate positive and negative class. for example [0.1, 0.3,0.5], this parameter effective only for &#39;binary&#39;</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">metrics</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">classi_type</span><span class="o">=</span><span class="s2">&quot;binary&quot;</span><span class="p">,</span> <span class="n">pos_label</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">thresholds</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="k">if</span> <span class="n">metrics</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="n">metrics</span> <span class="o">=</span> <span class="p">[]</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">metrics</span> <span class="o">=</span> <span class="n">metrics</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">classi_type</span> <span class="o">=</span> <span class="n">classi_type</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">pos_label</span> <span class="o">=</span> <span class="n">pos_label</span>
        <span class="k">if</span> <span class="n">thresholds</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="n">thresholds</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.5</span><span class="p">]</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">thresholds</span> <span class="o">=</span> <span class="n">thresholds</span></div>


<div class="viewcode-block" id="ObjectiveParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.ObjectiveParam">[docs]</a><span class="k">class</span> <span class="nc">ObjectiveParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define objective parameters that used in federated ml.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    objective : None or str, accepted None,&#39;cross_entropy&#39;,&#39;lse&#39;,&#39;lae&#39;,&#39;log_cosh&#39;,&#39;tweedie&#39;,&#39;fair&#39;,&#39;huber&#39; only,</span>
<span class="sd">                None in host&#39;s config, should be str in guest&#39;config.</span>
<span class="sd">                when task_type is classification, only support cross_enctropy,</span>
<span class="sd">                other 6 types support in regression task. default: None</span>

<span class="sd">    params : None or list, should be non empty list when objective is &#39;tweedie&#39;,&#39;fair&#39;,&#39;huber&#39;,</span>
<span class="sd">             first element of list shoulf be a float-number large than 0.0 when objective is &#39;fair&#39;,&#39;huber&#39;,</span>
<span class="sd">             first element of list should be a float-number in [1.0, 2.0) when objective is &#39;tweedie&#39;</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">objective</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">objective</span> <span class="o">=</span> <span class="n">objective</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">params</span> <span class="o">=</span> <span class="n">params</span></div>


<div class="viewcode-block" id="PredictParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.PredictParam">[docs]</a><span class="k">class</span> <span class="nc">PredictParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define the predict method of HomoLR, HeteroLR, SecureBoosting</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    with_proba: bool, Specify whether the result contains probability</span>

<span class="sd">    threshold: float or int, The threshold use to separate positive and negative class. Normally, it should be (0,1)</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">with_proba</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">threshold</span><span class="o">=</span><span class="mf">0.5</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">with_proba</span> <span class="o">=</span> <span class="n">with_proba</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">threshold</span> <span class="o">=</span> <span class="n">threshold</span></div>


<div class="viewcode-block" id="SampleParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.SampleParam">[docs]</a><span class="k">class</span> <span class="nc">SampleParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define the sample method</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    mode: str, accepted &#39;random&#39;,&#39;stratified&#39;&#39; only in this version, specify samplet to use, default: &#39;random&#39;</span>
<span class="sd">    </span>
<span class="sd">    method: str, accepted &#39;downsample&#39;,&#39;upsample&#39; only in this version. default: &#39;downsample&#39;</span>
<span class="sd">    </span>
<span class="sd">    fractions: None or float or list, if mode equals to random, it should be a float number greater than 0, otherwise a list of float elements. default: None</span>
<span class="sd">    </span>
<span class="sd">    random_state: int, RandomState instance or None, default: None</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s2">&quot;random&quot;</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s2">&quot;downsample&quot;</span><span class="p">,</span> <span class="n">fractions</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">random_state</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">mode</span> <span class="o">=</span> <span class="n">mode</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">method</span> <span class="o">=</span> <span class="n">method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">fractions</span> <span class="o">=</span> <span class="n">fractions</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">random_state</span> <span class="o">=</span> <span class="n">random_state</span></div>


<div class="viewcode-block" id="WorkFlowParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.WorkFlowParam">[docs]</a><span class="k">class</span> <span class="nc">WorkFlowParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define Workflow parameters used in federated ml.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    method : str, &#39;train&#39;, &#39;predict&#39;, &#39;intersect&#39; or &#39;cross_validation&#39;. default: &#39;train&#39;</span>
<span class="sd">        The working method of this task.</span>

<span class="sd">    train_input_table : str, default: None</span>
<span class="sd">        Required when method is &#39;train&#39;. Specify the table name of input data in database.</span>

<span class="sd">    train_input_namespace : str, default: None</span>
<span class="sd">        Required when method is &#39;train&#39;. Specify the namespace of input data in database.</span>

<span class="sd">    model_table : str, default: None</span>
<span class="sd">        Required when method is &#39;train&#39;, &#39;predict&#39; or &#39;cross_validation&#39;.</span>
<span class="sd">        Specify the table name to save or load model. When method is &#39;train&#39; or &#39;cross_validation&#39;, this parameter</span>
<span class="sd">        is used to save model. When method is predict, it is used to load model.</span>

<span class="sd">    model_namespace : str, default: None</span>
<span class="sd">        Required when method is &#39;train&#39;, &#39;predict&#39; or &#39;cross_validation&#39;.</span>
<span class="sd">        Specify the namespace to save or load model. When method is &#39;train&#39; or &#39;cross_validation&#39;, this parameter</span>
<span class="sd">        is used to save model. When method is predict, it is used to load model.</span>

<span class="sd">    predict_input_table : str, default: None</span>
<span class="sd">        Required when method is &#39;predict&#39;. Specify the table name of predict input data.</span>

<span class="sd">    predict_input_namespace : str, default: None</span>
<span class="sd">        Required when method is &#39;predict&#39;. Specify the namespace of predict input data in database.</span>

<span class="sd">    predict_result_partition : int, default: 1</span>
<span class="sd">        The partition number used for predict result.</span>

<span class="sd">    predict_output_table : str, default: None</span>
<span class="sd">        Required when method is &#39;predict&#39;. Specify the table name of predict output data.</span>

<span class="sd">    predict_output_namespace : str, default: None</span>
<span class="sd">        Required when method is &#39;predict&#39;. Specify the namespace of predict output data in database.</span>

<span class="sd">    evaluation_output_table : str, default: None</span>
<span class="sd">        Required when method is &#39;train&#39;, &#39;predict&#39; or &#39;cross_validation&#39;.</span>
<span class="sd">         Specify the table name of evalation output data.</span>

<span class="sd">    evaluation_output_namespace : str, default: None</span>
<span class="sd">        Required when method is &#39;train&#39;, &#39;predict&#39; or &#39;cross_validation&#39;.</span>
<span class="sd">         Specify the namespace of predict output data in database.</span>

<span class="sd">    data_input_table : str, defalut: None</span>
<span class="sd">        Required when method is &#39;cross_validation&#39;. Specify the table name of input data.</span>

<span class="sd">    data_input_namespace : str, defalut: None</span>
<span class="sd">        Required when method is &#39;cross_validation&#39;. Specify the namespace of input data.</span>

<span class="sd">    intersect_data_output_table : str, defalut: None</span>
<span class="sd">        Required when method is &#39;intersect&#39;. Specify the table name of output data.</span>

<span class="sd">    intersect_data_output_namespace : str, defalut: None</span>
<span class="sd">        Required when method is &#39;intersect&#39;. Specify the namespace of output data.</span>

<span class="sd">    do_cross_validation : Abandonded.</span>

<span class="sd">    work_mode: int, 0 or 1. default: 0</span>
<span class="sd">        Specify the work mode. 0 means standalone version, 1 represent for cluster version.</span>

<span class="sd">    n_splits: int, default: 5</span>
<span class="sd">        The number of fold used in KFold validation. It is required in &#39;cross_validation&#39; only.</span>

<span class="sd">    need_intersect: bool, default: True</span>
<span class="sd">        Whether this task need to do intersect. No need to specify in Homo task.</span>

<span class="sd">    need_sample: bool, default: False</span>
<span class="sd">        Whether this task need to do feature selection or not.</span>

<span class="sd">    need_feature_selection: bool, default: False</span>
<span class="sd">        Whether this task need to do feature selection or not.</span>

<span class="sd">    need_one_hot : bool, default: False</span>
<span class="sd">        Whether this task need to do one_hot encode</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;train&#39;</span><span class="p">,</span> <span class="n">train_input_table</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">train_input_namespace</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">model_table</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">model_namespace</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">predict_input_table</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">predict_input_namespace</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">predict_result_partition</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">predict_output_table</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">predict_output_namespace</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">evaluation_output_table</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">evaluation_output_namespace</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">data_input_table</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">data_input_namespace</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">intersect_data_output_table</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">intersect_data_output_namespace</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">dataio_param</span><span class="o">=</span><span class="n">DataIOParam</span><span class="p">(),</span> <span class="n">predict_param</span><span class="o">=</span><span class="n">PredictParam</span><span class="p">(),</span>
                 <span class="n">evaluate_param</span><span class="o">=</span><span class="n">EvaluateParam</span><span class="p">(),</span> <span class="n">do_cross_validation</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">work_mode</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
                 <span class="n">n_splits</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">need_intersect</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">need_sample</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">need_feature_selection</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">need_scale</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
                 <span class="n">one_vs_rest</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">need_one_hot</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">method</span> <span class="o">=</span> <span class="n">method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">train_input_table</span> <span class="o">=</span> <span class="n">train_input_table</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">train_input_namespace</span> <span class="o">=</span> <span class="n">train_input_namespace</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">model_table</span> <span class="o">=</span> <span class="n">model_table</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">model_namespace</span> <span class="o">=</span> <span class="n">model_namespace</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">predict_input_table</span> <span class="o">=</span> <span class="n">predict_input_table</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">predict_input_namespace</span> <span class="o">=</span> <span class="n">predict_input_namespace</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">predict_output_table</span> <span class="o">=</span> <span class="n">predict_output_table</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">predict_output_namespace</span> <span class="o">=</span> <span class="n">predict_output_namespace</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">predict_result_partition</span> <span class="o">=</span> <span class="n">predict_result_partition</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">evaluation_output_table</span> <span class="o">=</span> <span class="n">evaluation_output_table</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">evaluation_output_namespace</span> <span class="o">=</span> <span class="n">evaluation_output_namespace</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">data_input_table</span> <span class="o">=</span> <span class="n">data_input_table</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">data_input_namespace</span> <span class="o">=</span> <span class="n">data_input_namespace</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">intersect_data_output_table</span> <span class="o">=</span> <span class="n">intersect_data_output_table</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">intersect_data_output_namespace</span> <span class="o">=</span> <span class="n">intersect_data_output_namespace</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">dataio_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">dataio_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">do_cross_validation</span> <span class="o">=</span> <span class="n">do_cross_validation</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">n_splits</span> <span class="o">=</span> <span class="n">n_splits</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">work_mode</span> <span class="o">=</span> <span class="n">work_mode</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">predict_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">predict_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">evaluate_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">evaluate_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">need_intersect</span> <span class="o">=</span> <span class="n">need_intersect</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">need_sample</span> <span class="o">=</span> <span class="n">need_sample</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">need_feature_selection</span> <span class="o">=</span> <span class="n">need_feature_selection</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">need_scale</span> <span class="o">=</span> <span class="n">need_scale</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">need_one_hot</span> <span class="o">=</span> <span class="n">need_one_hot</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">one_vs_rest</span> <span class="o">=</span> <span class="n">one_vs_rest</span></div>


<div class="viewcode-block" id="InitParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.InitParam">[docs]</a><span class="k">class</span> <span class="nc">InitParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Initialize Parameters used in initializing a model.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    init_method : str, &#39;random_uniform&#39;, &#39;random_normal&#39;, &#39;ones&#39;, &#39;zeros&#39; or &#39;const&#39;. default: &#39;random_uniform&#39;</span>
<span class="sd">        Initial method.</span>

<span class="sd">    init_const : int or float, default: 1</span>
<span class="sd">        Required when init_method is &#39;const&#39;. Specify the constant.</span>

<span class="sd">    fit_intercept : bool, default: True</span>
<span class="sd">        Whether to initialize the intercept or not.</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">init_method</span><span class="o">=</span><span class="s1">&#39;random_uniform&#39;</span><span class="p">,</span> <span class="n">init_const</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">fit_intercept</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">init_method</span> <span class="o">=</span> <span class="n">init_method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">init_const</span> <span class="o">=</span> <span class="n">init_const</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">fit_intercept</span> <span class="o">=</span> <span class="n">fit_intercept</span></div>


<div class="viewcode-block" id="EncodeParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.EncodeParam">[docs]</a><span class="k">class</span> <span class="nc">EncodeParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define the encode method</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    salt: the src data string will be str = str + salt, default by empty string</span>

<span class="sd">    encode_method: str, the encode method of src data string, it support md5, sha1, sha224, sha256, sha384, sha512, default by None</span>

<span class="sd">    base64: bool, if True, the result of encode will be changed to base64, default by False</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">salt</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="n">encode_method</span><span class="o">=</span><span class="s1">&#39;none&#39;</span><span class="p">,</span> <span class="n">base64</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">salt</span> <span class="o">=</span> <span class="n">salt</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">encode_method</span> <span class="o">=</span> <span class="n">encode_method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">base64</span> <span class="o">=</span> <span class="n">base64</span></div>


<div class="viewcode-block" id="IntersectParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.IntersectParam">[docs]</a><span class="k">class</span> <span class="nc">IntersectParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define the intersect method</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    intersect_method: str, it supports &#39;rsa&#39; and &#39;raw&#39;, default by &#39;raw&#39;</span>

<span class="sd">    random_bit: positive int, it will define the encrypt length of rsa algorithm. It effective only for intersect_method is rsa</span>

<span class="sd">    is_send_intersect_ids: bool. In rsa, &#39;is_send_intersect_ids&#39; is True means guest will send intersect results to host, and False will not.</span>
<span class="sd">                            while in raw, &#39;is_send_intersect_ids&#39; is True means the role of &quot;join_role&quot; will send intersect results and the other will get them.</span>
<span class="sd">                            Default by True.</span>

<span class="sd">    is_get_intersect_ids: bool, In rsa, it will get the results from other. It effective only for rsa and only be True will other&#39;s &#39;is_send_intersect_ids&#39; is True.Default by True</span>

<span class="sd">    join_role: str, it supports &quot;guest&quot; and &quot;host&quot; only and effective only for raw. If it is &quot;guest&quot;, the host will send its ids to guest and find the intersection of</span>
<span class="sd">                ids in guest; if it is &quot;host&quot;, the guest will send its ids. Default by &quot;guest&quot;.</span>

<span class="sd">    with_encode: bool, if True, it will use encode method for intersect ids. It effective only for &quot;raw&quot;.</span>

<span class="sd">    encode_params: EncodeParam, it effective only for with_encode is True</span>
<span class="sd">    </span>
<span class="sd">    only_output_key: bool, if true, the results of intersection will include key and value which from input data; if false, it will just include key from input</span>
<span class="sd">                    data and the value will be empty or some useless character like &quot;intersect_id&quot;</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">intersect_method</span><span class="o">=</span><span class="n">consts</span><span class="o">.</span><span class="n">RAW</span><span class="p">,</span> <span class="n">random_bit</span><span class="o">=</span><span class="mi">128</span><span class="p">,</span> <span class="n">is_send_intersect_ids</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
                 <span class="n">is_get_intersect_ids</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">join_role</span><span class="o">=</span><span class="s2">&quot;guest&quot;</span><span class="p">,</span> <span class="n">with_encode</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="n">encode_params</span><span class="o">=</span><span class="n">EncodeParam</span><span class="p">(),</span>
                 <span class="n">only_output_key</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">intersect_method</span> <span class="o">=</span> <span class="n">intersect_method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">random_bit</span> <span class="o">=</span> <span class="n">random_bit</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">is_send_intersect_ids</span> <span class="o">=</span> <span class="n">is_send_intersect_ids</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">is_get_intersect_ids</span> <span class="o">=</span> <span class="n">is_get_intersect_ids</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">join_role</span> <span class="o">=</span> <span class="n">join_role</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">with_encode</span> <span class="o">=</span> <span class="n">with_encode</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">encode_params</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">encode_params</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">only_output_key</span> <span class="o">=</span> <span class="n">only_output_key</span></div>


<div class="viewcode-block" id="LogisticParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.LogisticParam">[docs]</a><span class="k">class</span> <span class="nc">LogisticParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Parameters used for Logistic Regression both for Homo mode or Hetero mode.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    penalty : str, &#39;L1&#39; or &#39;L2&#39;. default: &#39;L2&#39;</span>
<span class="sd">        Penalty method used in LR. Please note that, when using encrypted version in HomoLR,</span>
<span class="sd">        &#39;L1&#39; is not supported.</span>

<span class="sd">    eps : float, default: 1e-5</span>
<span class="sd">        The tolerance of convergence</span>

<span class="sd">    alpha : float, default: 1.0</span>
<span class="sd">        Regularization strength coefficient.</span>

<span class="sd">    optimizer : str, &#39;sgd&#39;, &#39;rmsprop&#39;, &#39;adam&#39; or &#39;adagrad&#39;, default: &#39;sgd&#39;</span>
<span class="sd">        Optimize method</span>

<span class="sd">    party_weight : int or float, default: 1</span>
<span class="sd">        Required in Homo LR. Setting the weight of model updated for this party.</span>
<span class="sd">        The higher weight set, the higher influence made for this party when updating model.</span>

<span class="sd">    batch_size : int, default: -1</span>
<span class="sd">        Batch size when updating model. -1 means use all data in a batch. i.e. Not to use mini-batch strategy.</span>

<span class="sd">    learning_rate : float, default: 0.01</span>
<span class="sd">        Learning rate</span>

<span class="sd">    max_iter : int, default: 100</span>
<span class="sd">        The maximum iteration for training.</span>

<span class="sd">    converge_func : str, &#39;diff&#39; or &#39;abs&#39;, default: &#39;diff&#39;</span>
<span class="sd">        Method used to judge converge or not.</span>
<span class="sd">            a)	diff： Use difference of loss between two iterations to judge whether converge.</span>
<span class="sd">            b)	abs: Use the absolute value of loss to judge whether converge. i.e. if loss &lt; eps, it is converged.</span>

<span class="sd">    re_encrypt_batches : int, default: 2</span>
<span class="sd">        Required when using encrypted version HomoLR. Since multiple batch updating coefficient may cause</span>
<span class="sd">        overflow error. The model need to be re-encrypt for every several batches. Please be careful when setting</span>
<span class="sd">        this parameter. Too large batches may cause training failure.</span>

<span class="sd">    model_path : Abandoned</span>

<span class="sd">    table_name : Abandoned</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">penalty</span><span class="o">=</span><span class="s1">&#39;L2&#39;</span><span class="p">,</span>
                 <span class="n">eps</span><span class="o">=</span><span class="mf">1e-5</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">optimizer</span><span class="o">=</span><span class="s1">&#39;sgd&#39;</span><span class="p">,</span> <span class="n">party_weight</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
                 <span class="n">batch_size</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">learning_rate</span><span class="o">=</span><span class="mf">0.01</span><span class="p">,</span> <span class="n">init_param</span><span class="o">=</span><span class="n">InitParam</span><span class="p">(),</span>
                 <span class="n">max_iter</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">converge_func</span><span class="o">=</span><span class="s1">&#39;diff&#39;</span><span class="p">,</span>
                 <span class="n">encrypt_param</span><span class="o">=</span><span class="n">EncryptParam</span><span class="p">(),</span> <span class="n">re_encrypt_batches</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span>
                 <span class="n">model_path</span><span class="o">=</span><span class="s1">&#39;lr_model&#39;</span><span class="p">,</span> <span class="n">table_name</span><span class="o">=</span><span class="s1">&#39;lr_table&#39;</span><span class="p">,</span>
                 <span class="n">encrypted_mode_calculator_param</span><span class="o">=</span><span class="n">EncryptedModeCalculatorParam</span><span class="p">()):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">penalty</span> <span class="o">=</span> <span class="n">penalty</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">eps</span> <span class="o">=</span> <span class="n">eps</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="n">alpha</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">optimizer</span> <span class="o">=</span> <span class="n">optimizer</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">batch_size</span> <span class="o">=</span> <span class="n">batch_size</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">learning_rate</span> <span class="o">=</span> <span class="n">learning_rate</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">init_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">init_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">max_iter</span> <span class="o">=</span> <span class="n">max_iter</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">converge_func</span> <span class="o">=</span> <span class="n">converge_func</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">encrypt_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">encrypt_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">re_encrypt_batches</span> <span class="o">=</span> <span class="n">re_encrypt_batches</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">model_path</span> <span class="o">=</span> <span class="n">model_path</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">table_name</span> <span class="o">=</span> <span class="n">table_name</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">party_weight</span> <span class="o">=</span> <span class="n">party_weight</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">encrypted_mode_calculator_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">encrypted_mode_calculator_param</span><span class="p">)</span></div>


<div class="viewcode-block" id="DecisionTreeParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.DecisionTreeParam">[docs]</a><span class="k">class</span> <span class="nc">DecisionTreeParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define decision tree parameters that used in federated ml.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    criterion_method : str, accepted &quot;xgboost&quot; only, the criterion function to use, default: &#39;xgboost&#39;</span>

<span class="sd">    criterion_params: list, should be non empty and first element is float-number, default: 0.1.</span>

<span class="sd">    max_depth: int, positive integer, the max depth of a decision tree, default: 5</span>

<span class="sd">    min_sample_split: int, least quantity of nodes to split, default: 2</span>

<span class="sd">    min_impurity_split: float, least gain of a single split need to reach, default: 1e-3</span>

<span class="sd">    min_leaf_node: int, when samples no more than min_leaf_node, it becomes a leave, default: 1</span>

<span class="sd">    max_split_nodes: int, positive integer, we will use no more than max_split_nodes to</span>
<span class="sd">                      parallel finding their splits in a batch, for memory consideration. default is 65536</span>

<span class="sd">    n_iter_no_change: bool, accepted True,False only, if set to True, tol will use to consider</span>
<span class="sd">                      stop tree growth. default: True</span>

<span class="sd">    feature_importance_type: str, support &#39;split&#39;, &#39;gain&#39; only. </span>
<span class="sd">                             if is &#39;split&#39;, feature_importances calculate by feature split times,</span>
<span class="sd">                             if is &#39;gain&#39;, feature_importances calculate by feature split gain.</span>
<span class="sd">                             default: &#39;split&#39;</span>

<span class="sd">    tol: float, only use when n_iter_no_change is set to True, default: 0.001</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">criterion_method</span><span class="o">=</span><span class="s2">&quot;xgboost&quot;</span><span class="p">,</span> <span class="n">criterion_params</span><span class="o">=</span><span class="p">[</span><span class="mf">0.1</span><span class="p">],</span> <span class="n">max_depth</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span>
                 <span class="n">min_sample_split</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">min_imputiry_split</span><span class="o">=</span><span class="mf">1e-3</span><span class="p">,</span> <span class="n">min_leaf_node</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
                 <span class="n">max_split_nodes</span><span class="o">=</span><span class="n">consts</span><span class="o">.</span><span class="n">MAX_SPLIT_NODES</span><span class="p">,</span> <span class="n">feature_importance_type</span><span class="o">=</span><span class="s2">&quot;split&quot;</span><span class="p">,</span>
                 <span class="n">n_iter_no_change</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">tol</span><span class="o">=</span><span class="mf">0.001</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">criterion_method</span> <span class="o">=</span> <span class="n">criterion_method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">criterion_params</span> <span class="o">=</span> <span class="n">criterion_params</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">max_depth</span> <span class="o">=</span> <span class="n">max_depth</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">min_sample_split</span> <span class="o">=</span> <span class="n">min_sample_split</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">min_impurity_split</span> <span class="o">=</span> <span class="n">min_imputiry_split</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">min_leaf_node</span> <span class="o">=</span> <span class="n">min_leaf_node</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">max_split_nodes</span> <span class="o">=</span> <span class="n">max_split_nodes</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">feature_importance_type</span> <span class="o">=</span> <span class="n">feature_importance_type</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">n_iter_no_change</span> <span class="o">=</span> <span class="n">n_iter_no_change</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">tol</span> <span class="o">=</span> <span class="n">tol</span></div>


<div class="viewcode-block" id="BoostingTreeParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.BoostingTreeParam">[docs]</a><span class="k">class</span> <span class="nc">BoostingTreeParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define boosting tree parameters that used in federated ml.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    task_type : str, accepted &#39;classification&#39;, &#39;regression&#39; only, default: &#39;classification&#39;</span>

<span class="sd">    tree_param : DecisionTreeParam Object, default: DecisionTreeParam()</span>

<span class="sd">    objective_param : ObjectiveParam Object, default: ObjectiveParam()</span>

<span class="sd">    learning_rate : float, accepted float, int or long only, the learning rate of secure boost. default: 0.3</span>

<span class="sd">    num_trees : int, accepted int, float only, the max number of trees to build. default: 5</span>

<span class="sd">    subsample_feature_rate : float, a float-number in [0, 1], default: 0.8</span>

<span class="sd">    n_iter_no_change : bool,</span>
<span class="sd">        when True and residual error less than tol, tree building process will stop. default: True</span>

<span class="sd">    encrypt_param : EncodeParam Object, encrypt method use in secure boost, default: EncryptParam()</span>

<span class="sd">    quantile_method : str, accepted &#39;bin_by_sample_data&#39; or &#39;bin_by_data_block&#39; only,</span>
<span class="sd">                      the quantile method use in secureboost, default: &#39;bin_by_sample_data&#39;</span>

<span class="sd">    bin_num: int, positive integer greater than 1, bin number use in quantile. default: 32</span>

<span class="sd">    bin_gap: float, least difference between bin points, default: 1e-3</span>

<span class="sd">    bin_sample_num: int, if quantile method is &#39;bin_by_sample_data&#39;, max amount of samples to find bins.</span>
<span class="sd">                    default: 10000</span>
<span class="sd">    </span>
<span class="sd">    encrypted_mode_calculator_param: EncryptedModeCalculatorParam object, the calculation mode use in secureboost,</span>
<span class="sd">                                     default: EncryptedModeCalculatorParam()</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">tree_param</span><span class="o">=</span><span class="n">DecisionTreeParam</span><span class="p">(),</span> <span class="n">task_type</span><span class="o">=</span><span class="n">consts</span><span class="o">.</span><span class="n">CLASSIFICATION</span><span class="p">,</span>
                 <span class="n">objective_param</span><span class="o">=</span><span class="n">ObjectiveParam</span><span class="p">(),</span>
                 <span class="n">learning_rate</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">num_trees</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">subsample_feature_rate</span><span class="o">=</span><span class="mf">0.8</span><span class="p">,</span> <span class="n">n_iter_no_change</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
                 <span class="n">tol</span><span class="o">=</span><span class="mf">0.0001</span><span class="p">,</span> <span class="n">encrypt_param</span><span class="o">=</span><span class="n">EncryptParam</span><span class="p">(),</span> <span class="n">quantile_method</span><span class="o">=</span><span class="s2">&quot;bin_by_sample_data&quot;</span><span class="p">,</span>
                 <span class="n">bin_num</span><span class="o">=</span><span class="mi">32</span><span class="p">,</span> <span class="n">bin_gap</span><span class="o">=</span><span class="mf">1e-3</span><span class="p">,</span> <span class="n">bin_sample_num</span><span class="o">=</span><span class="mi">10000</span><span class="p">,</span>
                 <span class="n">encrypted_mode_calculator_param</span><span class="o">=</span><span class="n">EncryptedModeCalculatorParam</span><span class="p">()):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">tree_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">tree_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">task_type</span> <span class="o">=</span> <span class="n">task_type</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">objective_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">objective_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">learning_rate</span> <span class="o">=</span> <span class="n">learning_rate</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">num_trees</span> <span class="o">=</span> <span class="n">num_trees</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">subsample_feature_rate</span> <span class="o">=</span> <span class="n">subsample_feature_rate</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">n_iter_no_change</span> <span class="o">=</span> <span class="n">n_iter_no_change</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">tol</span> <span class="o">=</span> <span class="n">tol</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">encrypt_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">encrypt_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">quantile_method</span> <span class="o">=</span> <span class="n">quantile_method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">bin_num</span> <span class="o">=</span> <span class="n">bin_num</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">bin_gap</span> <span class="o">=</span> <span class="n">bin_gap</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">bin_sample_num</span> <span class="o">=</span> <span class="n">bin_sample_num</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">encrypted_mode_calculator_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">EncryptedModeCalculatorParam</span><span class="p">())</span></div>


<div class="viewcode-block" id="FTLModelParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.FTLModelParam">[docs]</a><span class="k">class</span> <span class="nc">FTLModelParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Defines parameters for FTL model</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    max_iteration: integer, default: 10</span>
<span class="sd">        The number of passes over the training data (aka epochs), must be positive integer</span>

<span class="sd">    eps: numeric, default: 1e-3</span>
<span class="sd">        The converge threshold, must be positive number</span>

<span class="sd">    alpha: numeric, default: 100</span>
<span class="sd">        The weight for objective function loss, must be positive number</span>

<span class="sd">    is_encrypt: bool, default; True</span>
<span class="sd">        The indicator indicating whether we use encrypted version of ftl or plain version, must be bool</span>

<span class="sd">    enc_ftl: str default &quot;dct_enc_ftl&quot;</span>
<span class="sd">        The name for encrypted federated transfer learning algorithm</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">max_iteration</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">batch_size</span><span class="o">=</span><span class="mi">64</span><span class="p">,</span> <span class="n">eps</span><span class="o">=</span><span class="mf">1e-5</span><span class="p">,</span>
                 <span class="n">alpha</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">lr_decay</span><span class="o">=</span><span class="mf">0.001</span><span class="p">,</span> <span class="n">l2_para</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">is_encrypt</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">enc_ftl</span><span class="o">=</span><span class="s2">&quot;dct_enc_ftl&quot;</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">max_iter</span> <span class="o">=</span> <span class="n">max_iteration</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">batch_size</span> <span class="o">=</span> <span class="n">batch_size</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">eps</span> <span class="o">=</span> <span class="n">eps</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span> <span class="o">=</span> <span class="n">alpha</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">lr_decay</span> <span class="o">=</span> <span class="n">lr_decay</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">l2_para</span> <span class="o">=</span> <span class="n">l2_para</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">is_encrypt</span> <span class="o">=</span> <span class="n">is_encrypt</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">enc_ftl</span> <span class="o">=</span> <span class="n">enc_ftl</span></div>


<div class="viewcode-block" id="LocalModelParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.LocalModelParam">[docs]</a><span class="k">class</span> <span class="nc">LocalModelParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Defines parameters for FTL model</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    input_dim: integer, default: None</span>
<span class="sd">        The dimension of input samples, must be positive integer</span>

<span class="sd">    encode_dim: integer, default: 5</span>
<span class="sd">        The dimension of the encoded representation of input samples, must be positive integer</span>

<span class="sd">    learning_rate: float, default: 0.001</span>
<span class="sd">        The learning rate for training model, must between 0 and 1 exclusively</span>


<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">input_dim</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">encode_dim</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">learning_rate</span><span class="o">=</span><span class="mf">0.001</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">input_dim</span> <span class="o">=</span> <span class="n">input_dim</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">encode_dim</span> <span class="o">=</span> <span class="n">encode_dim</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">learning_rate</span> <span class="o">=</span> <span class="n">learning_rate</span></div>


<div class="viewcode-block" id="FTLDataParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.FTLDataParam">[docs]</a><span class="k">class</span> <span class="nc">FTLDataParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Defines parameters for FTL data model</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    file_path: str, default: None</span>
<span class="sd">        The file path to FTL data configuration JSON file, must be string or None</span>

<span class="sd">    n_feature_guest: integer, default: 10</span>
<span class="sd">        The number of features at guest side, must be positive integer</span>

<span class="sd">    n_feature_host: integer, default: 23</span>
<span class="sd">        The number of features at host side, must be positive integer</span>

<span class="sd">    overlap_ratio: float, default: 0.1</span>
<span class="sd">        The ratio of overlapping samples between guest and host, must between 0 and 1 exclusively</span>

<span class="sd">    guest_split_ratio: float, default: 0.9</span>
<span class="sd">        The ratio of number of samples excluding overlapping samples at guest side, must between 0 and 1 exclusively</span>

<span class="sd">    num_samples: numeric, default: None</span>
<span class="sd">        The total number of samples used for train/validation/test, must be positive integer or None. If None, all samples</span>
<span class="sd">        would be used.</span>

<span class="sd">    balanced: bool, default; True</span>
<span class="sd">        The indicator indicating whether balance samples, must be bool</span>

<span class="sd">    is_read_table: bool, default; False</span>
<span class="sd">        The indicator indicating whether read data from dtable, must be bool</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">file_path</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">n_feature_guest</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">n_feature_host</span><span class="o">=</span><span class="mi">23</span><span class="p">,</span> <span class="n">overlap_ratio</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> <span class="n">guest_split_ratio</span><span class="o">=</span><span class="mf">0.9</span><span class="p">,</span>
                 <span class="n">num_samples</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">balanced</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">is_read_table</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">file_path</span> <span class="o">=</span> <span class="n">file_path</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">n_feature_guest</span> <span class="o">=</span> <span class="n">n_feature_guest</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">n_feature_host</span> <span class="o">=</span> <span class="n">n_feature_host</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">overlap_ratio</span> <span class="o">=</span> <span class="n">overlap_ratio</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">guest_split_ratio</span> <span class="o">=</span> <span class="n">guest_split_ratio</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">num_samples</span> <span class="o">=</span> <span class="n">num_samples</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">balanced</span> <span class="o">=</span> <span class="n">balanced</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">is_read_table</span> <span class="o">=</span> <span class="n">is_read_table</span></div>


<div class="viewcode-block" id="FTLValidDataParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.FTLValidDataParam">[docs]</a><span class="k">class</span> <span class="nc">FTLValidDataParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Defines parameters for FTL validation data model</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    file_path: str, default: None</span>
<span class="sd">        The file path to FTL data configuration JSON file, must be string or None</span>

<span class="sd">    num_samples: numeric, default: None</span>
<span class="sd">        The total number of samples used for validation, must be positive integer or None. If None, all samples</span>
<span class="sd">        would be used.</span>

<span class="sd">    is_read_table: bool, default; False</span>
<span class="sd">        The indicator indicating whether read data from dtable, must be bool</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">file_path</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">num_samples</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">is_read_table</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">file_path</span> <span class="o">=</span> <span class="n">file_path</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">num_samples</span> <span class="o">=</span> <span class="n">num_samples</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">is_read_table</span> <span class="o">=</span> <span class="n">is_read_table</span></div>


<div class="viewcode-block" id="FeatureBinningParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.FeatureBinningParam">[docs]</a><span class="k">class</span> <span class="nc">FeatureBinningParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define the feature binning method</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    process_method : str, &#39;fit&#39; or &#39;transform&#39;, default: &quot;fit&quot;</span>
<span class="sd">        Specify what process to do.</span>

<span class="sd">    method : str, &#39;quantile&#39;, default: &#39;quantile&#39;</span>
<span class="sd">        Binning method.</span>

<span class="sd">    compress_thres: int, default: 10000</span>
<span class="sd">        When the number of saved summaries exceed this threshold, it will call its compress function</span>

<span class="sd">    head_size: int, default: 10000</span>
<span class="sd">        The buffer size to store inserted observations. When head list reach this buffer size, the</span>
<span class="sd">        QuantileSummaries object start to generate summary(or stats) and insert into its sampled list.</span>

<span class="sd">    error: float, 0 &lt;= error &lt; 1 default: 0.001</span>
<span class="sd">        The error of tolerance of binning. The final split point comes from original data, and the rank</span>
<span class="sd">        of this value is close to the exact rank. More precisely,</span>
<span class="sd">        floor((p - 2 * error) * N) &lt;= rank(x) &lt;= ceil((p + 2 * error) * N)</span>
<span class="sd">        where p is the quantile in float, and N is total number of data.</span>

<span class="sd">    bin_num: int, bin_num &gt; 0, default: 10</span>
<span class="sd">        The max bin number for binning</span>

<span class="sd">    cols : list of string or int, default: -1</span>
<span class="sd">        Specify which columns need to calculated. -1 represent for all columns. If you need to indicate specific</span>
<span class="sd">        cols, provide a list of header string instead of -1.</span>

<span class="sd">    adjustment_factor : float, default: 0.5</span>
<span class="sd">        the adjustment factor when calculating WOE. This is useful when there is no event or non-event in</span>
<span class="sd">        a bin.</span>

<span class="sd">    local_only : bool, default: False</span>
<span class="sd">        Whether just provide binning method to guest party. If true, host party will do nothing.</span>

<span class="sd">    display_result : list, default: [&#39;iv&#39;]</span>
<span class="sd">        Specify what results to show. The available results include:</span>
<span class="sd">        [&#39;iv&#39;, &#39;woe_array&#39;, &#39;iv_array&#39;, &#39;event_count_array&#39;, &#39;non_event_count_array&#39;, &#39;event_rate_array&#39;,</span>
<span class="sd">        &#39;non_event_rate_array&#39;, &#39;is_woe_monotonic&#39;, &#39;bin_nums&#39;, &#39;split_points&#39;]</span>
<span class="sd">        for each features</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">process_method</span><span class="o">=</span><span class="s1">&#39;fit&#39;</span><span class="p">,</span>
                 <span class="n">method</span><span class="o">=</span><span class="n">consts</span><span class="o">.</span><span class="n">QUANTILE</span><span class="p">,</span> <span class="n">compress_thres</span><span class="o">=</span><span class="n">consts</span><span class="o">.</span><span class="n">DEFAULT_COMPRESS_THRESHOLD</span><span class="p">,</span>
                 <span class="n">head_size</span><span class="o">=</span><span class="n">consts</span><span class="o">.</span><span class="n">DEFAULT_HEAD_SIZE</span><span class="p">,</span>
                 <span class="n">error</span><span class="o">=</span><span class="n">consts</span><span class="o">.</span><span class="n">DEFAULT_RELATIVE_ERROR</span><span class="p">,</span>
                 <span class="n">bin_num</span><span class="o">=</span><span class="n">consts</span><span class="o">.</span><span class="n">G_BIN_NUM</span><span class="p">,</span> <span class="n">cols</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">adjustment_factor</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span>
                 <span class="n">local_only</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">process_method</span> <span class="o">=</span> <span class="n">process_method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">method</span> <span class="o">=</span> <span class="n">method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">compress_thres</span> <span class="o">=</span> <span class="n">compress_thres</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">head_size</span> <span class="o">=</span> <span class="n">head_size</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">error</span> <span class="o">=</span> <span class="n">error</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">adjustment_factor</span> <span class="o">=</span> <span class="n">adjustment_factor</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">bin_num</span> <span class="o">=</span> <span class="n">bin_num</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">cols</span> <span class="o">=</span> <span class="n">cols</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">local_only</span> <span class="o">=</span> <span class="n">local_only</span></div>


<div class="viewcode-block" id="UniqueValueParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.UniqueValueParam">[docs]</a><span class="k">class</span> <span class="nc">UniqueValueParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Use the difference between max-value and min-value to judge.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    eps: float, default: 1e-5</span>
<span class="sd">        The column(s) will be filtered if its difference is smaller than eps.</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">eps</span><span class="o">=</span><span class="mf">1e-5</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">eps</span> <span class="o">=</span> <span class="n">eps</span></div>


<div class="viewcode-block" id="IVValueSelectionParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.IVValueSelectionParam">[docs]</a><span class="k">class</span> <span class="nc">IVValueSelectionParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Use information values to select features.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    value_threshold: float, default: 1.0</span>
<span class="sd">        Used if iv_value_thres method is used in feature selection.</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value_threshold</span><span class="o">=</span><span class="mf">1.0</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">value_threshold</span> <span class="o">=</span> <span class="n">value_threshold</span></div>


<div class="viewcode-block" id="IVPercentileSelectionParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.IVPercentileSelectionParam">[docs]</a><span class="k">class</span> <span class="nc">IVPercentileSelectionParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Use information values to select features.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    percentile_threshold: float, 0 &lt;= percentile_threshold &lt;= 1.0, default: 1.0</span>
<span class="sd">        Percentile threshold for iv_percentile method</span>


<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">percentile_threshold</span><span class="o">=</span><span class="mf">1.0</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">percentile_threshold</span> <span class="o">=</span> <span class="n">percentile_threshold</span></div>


<div class="viewcode-block" id="CoeffOfVarSelectionParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.CoeffOfVarSelectionParam">[docs]</a><span class="k">class</span> <span class="nc">CoeffOfVarSelectionParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Use coefficient of variation to select features. When judging, the absolute value will be used.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    value_threshold: float, default: 1.0</span>
<span class="sd">        Used if coefficient_of_variation_value_thres method is used in feature selection.</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value_threshold</span><span class="o">=</span><span class="mf">1.0</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">value_threshold</span> <span class="o">=</span> <span class="n">value_threshold</span></div>


<div class="viewcode-block" id="OutlierColsSelectionParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.OutlierColsSelectionParam">[docs]</a><span class="k">class</span> <span class="nc">OutlierColsSelectionParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Given percentile and threshold. Judge if this quantile point is larger than threshold. Filter those larger ones.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    percentile: float, [0., 1.] default: 1.0</span>
<span class="sd">        The percentile points to compare.</span>

<span class="sd">    upper_threshold: float, default: 1.0</span>
<span class="sd">        Percentile threshold for coefficient_of_variation_percentile method</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">percentile</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">upper_threshold</span><span class="o">=</span><span class="mf">1.0</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">percentile</span> <span class="o">=</span> <span class="n">percentile</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">upper_threshold</span> <span class="o">=</span> <span class="n">upper_threshold</span></div>


<div class="viewcode-block" id="FeatureSelectionParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.FeatureSelectionParam">[docs]</a><span class="k">class</span> <span class="nc">FeatureSelectionParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define the feature selection parameters.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    method : str, &#39;fit&#39;, &#39;transform&#39; or &#39;fit_transform&#39;, default: &#39;fit&#39;</span>
<span class="sd">        Decide what process to do.</span>
<span class="sd">        fit_transform: fit select models and transfer data instance</span>

<span class="sd">        transform: use fit models to transform data</span>

<span class="sd">        fit:  fit the model only without transforming the data.</span>

<span class="sd">    select_cols: list or int, default: -1</span>
<span class="sd">        Specify which columns need to calculated. -1 represent for all columns.</span>

<span class="sd">    filter_method: list, [&quot;unique_value&quot;, &quot;iv_value_thres&quot;, &quot;iv_percentile&quot;,</span>
<span class="sd">                &quot;coefficient_of_variation_value_thres&quot;, &quot;outlier_cols&quot;],</span>
<span class="sd">                 default: [&quot;unique_value&quot;, &quot;iv_value_thres&quot;,</span>
<span class="sd">                &quot;coefficient_of_variation_value_thres&quot;, &quot;outlier_cols&quot;]</span>

<span class="sd">        Specify the filter methods used in feature selection. The orders of filter used is depended on this list.</span>
<span class="sd">        Please be notified that, if a percentile method is used after some certain filter method,</span>
<span class="sd">        the percentile represent for the ratio of rest features.</span>

<span class="sd">        e.g. If you have 10 features at the beginning. After first filter method, you have 8 rest. Then, you want</span>
<span class="sd">        top 80% highest iv feature. Here, we will choose floor(0.8 * 8) = 6 features instead of 8.</span>

<span class="sd">        unique_value: filter the columns if all values in this feature is the same</span>

<span class="sd">        iv_value_thres: Use information value to filter columns. If this method is set, a float threshold need to be provided.</span>
<span class="sd">            Filter those columns whose iv is smaller than threshold.</span>

<span class="sd">        iv_percentile: Use information value to filter columns. If this method is set, a float ratio threshold</span>
<span class="sd">            need to be provided. Pick floor(ratio * feature_num) features with higher iv. If multiple features around</span>
<span class="sd">            the threshold are same, all those columns will be keep.</span>

<span class="sd">        coefficient_of_variation_value_thres: Use coefficient of variation to judge whether filtered or not.</span>

<span class="sd">        outlier_cols: Filter columns whose certain percentile value is larger than a threshold.</span>

<span class="sd">        Note: iv_value_thres and iv_percentile should not exist at the same times</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;fit&#39;</span><span class="p">,</span> <span class="n">select_cols</span><span class="o">=-</span><span class="mi">1</span><span class="p">,</span> <span class="n">filter_method</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">local_only</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
                 <span class="n">unique_param</span><span class="o">=</span><span class="n">UniqueValueParam</span><span class="p">(),</span>
                 <span class="n">iv_value_param</span><span class="o">=</span><span class="n">IVValueSelectionParam</span><span class="p">(),</span>
                 <span class="n">iv_percentile_param</span><span class="o">=</span><span class="n">IVPercentileSelectionParam</span><span class="p">(),</span>
                 <span class="n">coe_param</span><span class="o">=</span><span class="n">CoeffOfVarSelectionParam</span><span class="p">(),</span>
                 <span class="n">outlier_param</span><span class="o">=</span><span class="n">OutlierColsSelectionParam</span><span class="p">(),</span> <span class="n">bin_param</span><span class="o">=</span><span class="n">FeatureBinningParam</span><span class="p">()</span>
                 <span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">method</span> <span class="o">=</span> <span class="n">method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">select_cols</span> <span class="o">=</span> <span class="n">select_cols</span>
        <span class="k">if</span> <span class="n">filter_method</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">filter_method</span> <span class="o">=</span> <span class="p">[</span><span class="n">consts</span><span class="o">.</span><span class="n">UNIQUE_VALUE</span><span class="p">]</span>
        <span class="k">else</span><span class="p">:</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">filter_method</span> <span class="o">=</span> <span class="n">filter_method</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">local_only</span> <span class="o">=</span> <span class="n">local_only</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">unique_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">unique_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">iv_value_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">iv_value_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">iv_percentile_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">iv_percentile_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">coe_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">coe_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">outlier_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">outlier_param</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">bin_param</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">bin_param</span><span class="p">)</span></div>


<div class="viewcode-block" id="ScaleParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.ScaleParam">[docs]</a><span class="k">class</span> <span class="nc">ScaleParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define the feature scale parameters.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">        method : str, now it support &quot;min_max_scale&quot; and &quot;standard_scale&quot;, and will support other scale method soon.</span>
<span class="sd">                 Default None, which will do nothing for scale</span>

<span class="sd">        mode: str, for method is &quot;min_max_scale&quot; and for &quot;standard_scale&quot; it is useless, the mode just support &quot;normal&quot; now, and will support &quot;cap&quot; mode in the furture.</span>
<span class="sd">              for mode is &quot;min_max_scale&quot;, the feat_upper and feat_lower is the normal value and for &quot;cap&quot;, feat_upper and</span>
<span class="sd">              feature_lower will between 0 and 1, which means the percentile of the column. Default &quot;normal&quot;</span>

<span class="sd">        area: str, for method is &quot;min_max_scale&quot; and for &quot;standard_scale&quot; it is useless. It supports &quot;all&quot; and &quot;col&quot;. For &quot;all&quot;,</span>
<span class="sd">            feat_upper/feat_lower will act on all data column, so it will just be a value, and for &quot;col&quot;, it just acts </span>
<span class="sd">            on one column they corresponding to, so feat_lower/feat_upper will be a list, which size will equal to the number of columns</span>

<span class="sd">        feat_upper: int or float, used for &quot;min_max_scale&quot;, the upper limit in the column. If the value is larger than feat_upper, it will be set to feat_upper. Default None.</span>
<span class="sd">        feat_lower: int or float, used for &quot;min_max_scale&quot;, the lower limit in the column. If the value is less than feat_lower, it will be set to feat_lower. Default None.</span>
<span class="sd">        out_upper: int or float, used for &quot;min_max_scale&quot;, The results of scale will be mapped to the area between out_lower and out_upper.Default None.</span>
<span class="sd">        out_upper: int or float, used for &quot;min_max_scale&quot;, The results of scale will be mapped to the area between out_lower and out_upper.Default None.</span>
<span class="sd">        </span>

<span class="sd">        with_mean: bool, used for &quot;standard_scale&quot;. Default False.</span>
<span class="sd">        with_std: bool, used for &quot;standard_scale&quot;. Default False.</span>
<span class="sd">            The standard scale of column x is calculated as : z = (x - u) / s, where u is the mean of the column and s is the standard deviation of the column.</span>
<span class="sd">            if with_mean is False, u will be 0, and if with_std is False, s will be 1. </span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s2">&quot;normal&quot;</span><span class="p">,</span> <span class="n">area</span><span class="o">=</span><span class="s2">&quot;all&quot;</span><span class="p">,</span> <span class="n">feat_upper</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">feat_lower</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">out_upper</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
                 <span class="n">out_lower</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">with_mean</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">with_std</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">method</span> <span class="o">=</span> <span class="n">method</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">mode</span> <span class="o">=</span> <span class="n">mode</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">area</span> <span class="o">=</span> <span class="n">area</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">feat_upper</span> <span class="o">=</span> <span class="n">feat_upper</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">feat_lower</span> <span class="o">=</span> <span class="n">feat_lower</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">out_upper</span> <span class="o">=</span> <span class="n">out_upper</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">out_lower</span> <span class="o">=</span> <span class="n">out_lower</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">with_mean</span> <span class="o">=</span> <span class="n">with_mean</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">with_std</span> <span class="o">=</span> <span class="n">with_std</span></div>


<div class="viewcode-block" id="OneHotEncoderParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.OneHotEncoderParam">[docs]</a><span class="k">class</span> <span class="nc">OneHotEncoderParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>

<span class="sd">    cols: list or int, default: -1</span>
<span class="sd">        Specify which columns need to calculated. -1 represent for all columns.</span>

<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">cols</span><span class="o">=-</span><span class="mi">1</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">cols</span> <span class="o">=</span> <span class="n">cols</span></div>


<div class="viewcode-block" id="OneVsRestParam"><a class="viewcode-back" href="../../../federatedml.param.html#federatedml.param.param.OneVsRestParam">[docs]</a><span class="k">class</span> <span class="nc">OneVsRestParam</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">    Define the one_vs_rest parameters.</span>

<span class="sd">    Parameters</span>
<span class="sd">    ----------</span>
<span class="sd">    has_arbiter: bool. For some algorithm, may not has arbiter, for instances, secureboost of FATE,  for these algorithms, it should be set to false.</span>
<span class="sd">                default true</span>
<span class="sd">    &quot;&quot;&quot;</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">has_arbiter</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">has_arbiter</span> <span class="o">=</span> <span class="n">has_arbiter</span></div>
</pre></div>

           </div>
           
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, FATE_TEAM

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>